<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@include file="../template/header.jsp" %>
<%
float cartTotal = 0;
%>
<div class="row-fluid">
	<table class="table">
		<thead>
			<tr>
				<th></th>
				<th>Item</th>
				<th>Qty</th>
				<th>Price</th>
				<th></th>
				<th></th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${model.userCart.userCartBooks}" var="userCartBook">
				<form method="post" action="${pageContext.request.contextPath}/UserCartBooks/edit?id=${userCartBook.id}">
					<tr>
						<td><img class="book_icon" src="${pageContext.request.contextPath}/assets/img/books/tn/${userCartBook.book.coverImage}" /></td>
						<td><a href="${pageContext.request.contextPath}/books/view?id=${userCartBook.book.id}">${userCartBook.book.name}</a></td>
						<td><input class="span4" type="number" name="qty" value="${userCartBook.qty}" /></td>
						<td>$<fmt:formatNumber pattern="00.00" value="${userCartBook.book.price}"/></td>
						<td><input type="submit" class="btn btn-success" value="Update" /></td>
						<td><a href="${pageContext.request.contextPath}/UserCartBooks/delete?id=${userCartBook.id}" class="btn btn-danger">Delete</a>
					</tr>
				</form>
			</c:forEach>
		</tbody>
		<tfoot>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td><h4>Total:</h4></td>
				<td>$<fmt:formatNumber pattern="00.00" value="${model.cartTotal}"/></td>
			</tr>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td><a onclick="alert('This feature isn\'t integrated with WSU bookstore.')"class="btn btn-wsu">Check Out</a></td>
			</tr>
		</tfoot>
	</table>
</div>
<%@include file="../template/footer.jsp" %>